#!/usr/bin/python
# coding=utf-8

import sys
import base64
import urllib
import chardet
import binascii
from pyDes import *


Des_Key = "12345678"  # Key
Des_IV = Des_Key      # IV

def decrypt():
    str = '3cd46227c097a6d27ad988598c4b79874d689ce529de33333e20bc71f624696bb8a' \
          '26368a3b43584662e2239105bf19481ee3c4aeac333e235c104c5bfedfc8c1c6f16' \
          'c0d65a45e1a0b0fd48480bb2d45efb6119af471d09e5aae795ff938040b11ae3a07' \
          '807e345ba3f1f4a3b24a850aeb4e45d66acb5bbb487d842a5bf266a41c00a351b4b' \
          'c934d4e8fb0186d1b4a17af088eb81721fa69e17d08f9acb93601844f7637c01043' \
          'f40ad6002a54d83d03b38425904368cfe88003bac0f18fb6586bbbece030b1d6556' \
          '96a977486f4dc0d9fd2453a159f8b54c9f8f4687aa903d579159a4257d0f9e57760' \
          '9c6ba09d7129f93ae76f3ae691248b7b78eda53a7f42427f69eb8038a4aeeb713db' \
          '9211175595c2fc763e8360b925004f12e386a1f14d6dea03d0fc50cd478f875f12c' \
          '1342257d10b75a5f442c3bb3d20e223102f6994d9b5bda119d2bac6b2c23769bc69' \
          '27e4cc32fb06ef40d4ff1d94f930d43c9a3658537396cc04e3a885660422d6afe1d' \
          'f9678d36a312803d2c55c7a18ed163445691d88eb3b5325adba26e849d863a127c1' \
          '7da099420fcf03a96c0444d2a13314b4cbf5c699d6624f8ed438ee0ae4bc9d4deb6' \
          'e648f22ec53f62ca79239966c9de4c22076ab6f36e5f153715815221b';
    k = des(Des_Key, CBC, Des_IV, pad=None, padmode=PAD_PKCS5)
    # print(chardet.detect(str))
    DECRYPTStr = k.decrypt(binascii.a2b_hex(str), padmode=PAD_PKCS5)
    # print(chardet.detect(DECRYPTStr))
    DECRYPTStr = urllib.unquote(DECRYPTStr)
    print(DECRYPTStr)
    # print(base64.b64decode(DECRYPTStr))
    # print(chardet.detect(DECRYPTStr))



if __name__ == '__main__':
    decrypt()
    # print(bytearray(Des_Key))

